package com.xuebang.admin.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import com.xuebang.admin.entity.HdPrepare;
import com.xuebang.admin.entity.OperatorGroups;

public interface OperatorGroupsMapper extends BaseMapper<OperatorGroups> {

	@Select("select * from operator_groups")
	List<HdPrepare> search();

	@InsertProvider(type = SQLProvider.class, method = "insert")
	@SelectKey(statement = "select last_insert_id()", keyProperty = "groupId", before = false, resultType = Long.class)
	void insertOperatorGroups(OperatorGroups operatorGroups);
	
	@Update("update operator_groups set group_name = #{groupName},descr = #{descr},modify_date = #{modifyDate} where GROUP_ID = #{groupId}")
	void updateOperatorGroups(OperatorGroups operatorGroups);

	@Delete("delete from operator_groups where GROUP_ID = #{groupId} ")
	void deleteOperatorGroups(Long groupId);

	@Select("select * from operator_groups where group_name=#{groupName}")
	List<OperatorGroups> findByName(String groupName);
}
